package com.jia.leetCode;

/**
 * @program: Leetcode
 * @description:
 * @author: STU756
 * @create: 2020-08-09 11:06
 */
public class Pro5484 {
    public char findKthBit(int n, int k) {
        StringBuilder sb = new StringBuilder("0");
        for(int i = 2; i <= n; i++) {
            StringBuilder reverseSb = new StringBuilder(sb).reverse();
            for(int j =0; j < reverseSb.length(); j++) {
                int c = reverseSb.charAt(j) - '0';
                reverseSb.setCharAt(j, (char) (((c+1)&0x1) + '0'));
            }
            sb.append("1").append(reverseSb);
            System.out.println("aa");
        }
        return sb.charAt(k-1);
    }

    public static void main(String[] args) {
        Pro5484 pro5484 = new Pro5484();
        System.out.println(pro5484.findKthBit(4, 11));
    }
}
